#include "reg51.h"

typedef unsigned int u16;	
typedef unsigned char u8;


sbit SRCLK=P3^6;	
sbit RCLK=P3^5;		
sbit SER=P3^4; 		

#define LEDDZ_COL_PORT	P0	



void delay_10us(u16 ten_us)
{
	while(ten_us--);	
}


void hc595_write_data(u8 dat)
{
	u8 i=0;
	
	for(i=0;i<8;i++)
	{
		SER=dat>>7;
		dat<<=1;
		SRCLK=0;
		delay_10us(1);
		SRCLK=1;
		delay_10us(1);
	}
	RCLK=0;
	delay_10us(1);
	RCLK=1;	
}


void main()
{	
	u8 i=0;

	LEDDZ_COL_PORT=0x7f;
	while(1)
	{			
		hc595_write_data(0x80);						
	}		
}